﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using FlashCards.Model;

namespace FlashCards.WebApp.Models
{
    public class AddCategoryModel
    {
        public AddCategoryModel(List<Category> categories)
        {
            categories.Sort((x, y) => x.Name.CompareTo(y.Name));

            Categories = new List<CategoryModel>();
            Categories.Add(new CategoryModel(new Category { Name = string.Empty }));

            foreach (var item in categories)
                Categories.Add(new CategoryModel(item));
        }

        public string SelectedItemId { get; set; }
        public List<CategoryModel> Categories { get; set; }
    }
}